namespace Crux.Core.Websockets;

/// <summary>
///
/// </summary>
public static class ClientProxyExtensions
{
    /// <summary>
    ///
    /// </summary>
    /// <param name="clientProxy"></param>
    /// <param name="method"></param>
    /// <param name="cancellationToken"></param>
    /// <returns></returns>
    public static Task SendAsync(
        this IClientProxy clientProxy,
        string method,
        CancellationToken cancellationToken = default) =>
          clientProxy.SendCoreAsync(
            method,
            Array.Empty<object>(),
            cancellationToken);
    /// <summary>
    ///
    /// </summary>
    /// <param name="clientProxy"></param>
    /// <param name="method"></param>
    /// <param name="arg1"></param>
    /// <param name="cancellationToken"></param>
    /// <returns></returns>
    public static Task SendAsync(
        this IClientProxy clientProxy,
        string method,
        object arg1,
        CancellationToken cancellationToken = default) => clientProxy.SendCoreAsync(
            method,
            [arg1],
            cancellationToken);
    /// <summary>
    ///
    /// </summary>
    /// <param name="clientProxy"></param>
    /// <param name="method"></param>
    /// <param name="arg1"></param>
    /// <param name="arg2"></param>
    /// <param name="cancellationToken"></param>
    /// <returns></returns>
    public static Task SendAsync(
        this IClientProxy clientProxy,
        string method,
        object arg1,
        object arg2,
        CancellationToken cancellationToken = default) => clientProxy.SendCoreAsync(
            method,
            [arg1, arg2],
            cancellationToken);
    /// <summary>
    ///
    /// </summary>
    /// <param name="clientProxy"></param>
    /// <param name="method"></param>
    /// <param name="arg1"></param>
    /// <param name="arg2"></param>
    /// <param name="arg3"></param>
    /// <param name="cancellationToken"></param>
    /// <returns></returns>
    public static Task SendAsync(
        this IClientProxy clientProxy,
        string method,
        object arg1,
        object arg2,
        object arg3,
        CancellationToken cancellationToken = default) => clientProxy.SendCoreAsync(
            method,
            [arg1, arg2, arg3],
            cancellationToken);
    /// <summary>
    ///
    /// </summary>
    /// <param name="clientProxy"></param>
    /// <param name="method"></param>
    /// <param name="arg1"></param>
    /// <param name="arg2"></param>
    /// <param name="arg3"></param>
    /// <param name="arg4"></param>
    /// <param name="cancellationToken"></param>
    /// <returns></returns>
    public static Task SendAsync(
        this IClientProxy clientProxy,
        string method,
        object arg1,
        object arg2,
        object arg3,
        object arg4,
        CancellationToken cancellationToken = default) => clientProxy.SendCoreAsync(
            method,
            [arg1, arg2, arg3, arg4],
            cancellationToken);
    /// <summary>
    ///
    /// </summary>
    /// <param name="clientProxy"></param>
    /// <param name="method"></param>
    /// <param name="arg1"></param>
    /// <param name="arg2"></param>
    /// <param name="arg3"></param>
    /// <param name="arg4"></param>
    /// <param name="arg5"></param>
    /// <param name="cancellationToken"></param>
    /// <returns></returns>
    public static Task SendAsync(
        this IClientProxy clientProxy,
        string method,
        object arg1,
        object arg2,
        object arg3,
        object arg4,
        object arg5,
        CancellationToken cancellationToken = default) => clientProxy.SendCoreAsync(
            method,
            [arg1, arg2, arg3, arg4, arg5],
            cancellationToken);
    /// <summary>
    ///
    /// </summary>
    /// <param name="clientProxy"></param>
    /// <param name="method"></param>
    /// <param name="arg1"></param>
    /// <param name="arg2"></param>
    /// <param name="arg3"></param>
    /// <param name="arg4"></param>
    /// <param name="arg5"></param>
    /// <param name="arg6"></param>
    /// <param name="cancellationToken"></param>
    /// <returns></returns>
    public static Task SendAsync(
        this IClientProxy clientProxy,
        string method,
        object arg1,
        object arg2,
        object arg3,
        object arg4,
        object arg5,
        object arg6,
        CancellationToken cancellationToken = default) => clientProxy.SendCoreAsync(
            method,
            [arg1, arg2, arg3, arg4, arg5, arg6],
            cancellationToken);
    /// <summary>
    ///
    /// </summary>
    /// <param name="clientProxy"></param>
    /// <param name="method"></param>
    /// <param name="arg1"></param>
    /// <param name="arg2"></param>
    /// <param name="arg3"></param>
    /// <param name="arg4"></param>
    /// <param name="arg5"></param>
    /// <param name="arg6"></param>
    /// <param name="arg7"></param>
    /// <param name="cancellationToken"></param>
    /// <returns></returns>
    public static Task SendAsync(
        this IClientProxy clientProxy,
        string method,
        object arg1,
        object arg2,
        object arg3,
        object arg4,
        object arg5,
        object arg6,
        object arg7,
        CancellationToken cancellationToken = default) => clientProxy.SendCoreAsync(
            method,
            [arg1, arg2, arg3, arg4, arg5, arg6, arg7],
            cancellationToken);
    /// <summary>
    ///
    /// </summary>
    /// <param name="clientProxy"></param>
    /// <param name="method"></param>
    /// <param name="arg1"></param>
    /// <param name="arg2"></param>
    /// <param name="arg3"></param>
    /// <param name="arg4"></param>
    /// <param name="arg5"></param>
    /// <param name="arg6"></param>
    /// <param name="arg7"></param>
    /// <param name="arg8"></param>
    /// <param name="cancellationToken"></param>
    /// <returns></returns>
    public static Task SendAsync(
        this IClientProxy clientProxy,
        string method,
        object arg1,
        object arg2,
        object arg3,
        object arg4,
        object arg5,
        object arg6,
        object arg7,
        object arg8,
        CancellationToken cancellationToken = default) => clientProxy.SendCoreAsync(
            method,
            [arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8],
            cancellationToken);
    /// <summary>
    ///
    /// </summary>
    /// <param name="clientProxy"></param>
    /// <param name="method"></param>
    /// <param name="arg1"></param>
    /// <param name="arg2"></param>
    /// <param name="arg3"></param>
    /// <param name="arg4"></param>
    /// <param name="arg5"></param>
    /// <param name="arg6"></param>
    /// <param name="arg7"></param>
    /// <param name="arg8"></param>
    /// <param name="arg9"></param>
    /// <param name="cancellationToken"></param>
    /// <returns></returns>
    public static Task SendAsync(
        this IClientProxy clientProxy,
        string method,
        object arg1,
        object arg2,
        object arg3,
        object arg4,
        object arg5,
        object arg6,
        object arg7,
        object arg8,
        object arg9,
        CancellationToken cancellationToken = default) => clientProxy.SendCoreAsync(
            method,
            [arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9],
            cancellationToken);
}
